import sys
input=sys.stdin.readline
def inp():
return int(input())
def st():
return input().rstrip('\n')
def lis():
return list(map(int,input().split()))
def ma():
return map(int,input().split())
t=1
while(t):
t-=1
n=inp()
n=abs(n+0)
cur=1
mo=0
x=0
while(1):
if((x+cur)<n):
cur+=1
mo+=1
x+=cur-1
else:
cur+=1
mo+=1
x+=cur-1
break
if((x-n)%2):
x+=cur
if((x-n)%2==0):
mo+=1
else:
mo+=2
if(n==0):
mo=0
print(mo)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key
#define ld long double
#define vll vector<int>
#define vpl vector<pair<int, int>>
#define pb push_back
#define all(n) n.begin(), n.end()
#define rev(n) reverse(n.begin(), n.end())
#define fr(n) for(int i=0; i<n; i++)
#define frl(k,n) for(int j=k; j<n; j++)
#define cinv(a,n) for(int j=0;j<n;j++) cin>>a[j]
#define yn(x) cout << ((x) ? "YES\n" : "NO\n")
#define endl '\n'
const int M = 1e9+7;
bool poweroftwo(int n) { return !(n & (n - 1)); }
int pow(int a, int b, int m=M) {int ans=1;while (b){if(b&1) ans=(ans*a)%m; a=(a*a)%m; b >>= 1;}return ans;}
// const int N = 4e4;
// bool seive[N]; vector<int> primes;
// void know_all_primes(){for(int i = 2; i < N; ++i){seive[i] = true;}for(int i = 2; i < N; ++i){if (seive[i]) {primes.push_back(i);for(int j = i *i; j < N; j += i){seive[j] = false;}}}}
vector<int> know_all_prime(int num) { vector<int> ans; for(int i=2; i*i<=num; i++) { if(num%i==0) { ans.push_back(i);} while (num % i == 0) { num /= i;}} if (num > 1){ ans.push_back(num); } return ans; }
mt19937 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
void testCase(){
int n = 0, m = 0, c = 0, k = -1, sum = 0; string s; bool f = true;
cin >> k;
k = abs(k);
m = 2*k;
c = sqrt(m);
n = c*(c+1);
if(n == m) {
cout << c << endl; return;
}
if(n/2 > k) c--;
n = c*(c+1)/2;
sum = k - n;
if(sum&1 and c&1) cout << c+2 << endl;
else if(sum%2==0 and c%2==0) cout << c+3 << endl;
else cout << c+1 << endl;
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int test = 1;
// cin >> test;
while(test--) {testCase();}
return 0;
}
156C - Cipher | 545D - Queue |
459B - Pashmak and Flowers | 1538A - Stone Game |
1454C - Sequence Transformation | 165B - Burning Midnight Oil |
17A - Noldbach problem | 1350A - Orac and Factors |
1373A - Donut Shops | 26A - Almost Prime |
1656E - Equal Tree Sums | 1656B - Subtract Operation |
1656A - Good Pairs | 1367A - Short Substrings |
87A - Trains | 664A - Complicated GCD |
1635D - Infinite Set | 1462A - Favorite Sequence |
1445B - Elimination | 1656C - Make Equal With Mod |
567A - Lineland Mail | 1553A - Digits Sum |
1359B - New Theatre Square | 766A - Mahmoud and Longest Uncommon Subsequence |
701B - Cells Not Under Attack | 702A - Maximum Increase |
1656D - K-good | 1426A - Floor Number |
876A - Trip For Meal | 1326B - Maximums |